package com.xcf.service.business.bookingcargo.impl;

import cn.com.xcf.dao.mapper.FactBookingCargoMapper;
import cn.com.xcf.dao.mapper.FactBookingNoteMapper;
import cn.com.xcf.dao.model.FactBookingCargo;
import cn.com.xcf.dao.model.FactBookingNote;
import com.google.common.collect.Maps;
import com.xcf.service.business.bookingcargo.BookingCargoService;
import com.xcf.util.PageData;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * author ：yangchao
 * date ：2017/11/24
 * Description：
 *
 * @version V1.0
 */
@Service
public class BookingCargoServiceImpl implements BookingCargoService {

    @Autowired
    private FactBookingNoteMapper bookingNoteMapper;
    @Autowired
    private FactBookingCargoMapper bookingCargoMapper;

    @Override
    public List<Map> queryList(Map params) {
        return bookingNoteMapper.queryList(params);
    }
    @Override
    public List<Map> queryByPage(Map params) {
        return bookingNoteMapper.queryByPage(params);
    }

    @Override
    public List<Map> queryByPageByBillCode(Map params) {
        return bookingNoteMapper.queryByPageByBillCode(params);
    }

    @Override
    public FactBookingCargo queryByBillCode(String billCode) {
        Map param = Maps.newHashMap();
        param.put("billCode", billCode);
        List<FactBookingCargo> list = bookingCargoMapper.queryByParams(param);
        if (list.size() > 0) {
            return list.get(0);
        }
        return null;
    }


    @Override
    public boolean saveBookingCargo(FactBookingCargo bookingCargo) {
        return bookingCargoMapper.insert(bookingCargo) > 0 ? true : false;
    }

    @Override
    public boolean modifyBookingCargo(FactBookingCargo bookingCargo) {
        return bookingCargoMapper.update(bookingCargo) > 0 ? true : false;
    }

    @Override
    public List<Map> findRiverShipCompany(Map params) {
        return bookingNoteMapper.findRiverShipCompany(params);
    }

    public List<Map> findFeeName(Map params) {
        return bookingNoteMapper.findFeeName(params);
    }

    public List<Map> findSettlement(Map params) {
        return bookingNoteMapper.findSettlement(params);
    }

    public int saveFeeInfo(PageData pd) {
        return bookingNoteMapper.saveFeeInfo(pd);
    }

    @Override
    public int saveFeeCopeInfo(PageData pd) {

        return bookingNoteMapper.saveFeeCopeInfo(pd);
    }

    @Override
    public List<Map> findFee(Map params) {

        return bookingNoteMapper.findFee(params);
    }

    public List<Map> findBoxtype(Map params) {

        return bookingNoteMapper.findBoxtype(params);
    }

    @Override
    public List<Map> findCopeFee(Map params) {

        return bookingNoteMapper.findCopeFee(params);
    }

    @Override
    public void deleteFee(PageData pd) {
        bookingNoteMapper.deleteFee(pd);

    }

    @Override
    public void deleteCopeFee(PageData pd) {
        bookingNoteMapper.deleteCopeFee(pd);

    }

    @Override
    public void updateFeeInfo(PageData pd) {
        bookingNoteMapper.updateFeeInfo(pd);
    }

    @Override
    public void updateCopeFeeInfo(PageData pd) {
        bookingNoteMapper.updateCopeFeeInfo(pd);
    }

    @Override
    public PageData findTrailerById(String ID) {
        return bookingNoteMapper.findTrailerById(ID);
    }

    //修改
	@Override
	public void update(PageData pd) {
		bookingNoteMapper.update(pd);
		
	}

	//查询结算单位下拉
	@Override
	public List<PageData> findjiesuan(PageData pd) {
		
		return bookingNoteMapper.findjiesuan(pd);
	}

	@Override
	public void editState(PageData pd) {
		bookingNoteMapper.editState(pd);
		
	}

	@Override
	public void editFeeInfo(PageData pd) {
		bookingNoteMapper.editFeeInfo(pd);
		
	}

	@Override
	public void editCostInfo(PageData pd) {
		bookingNoteMapper.editCostInfo(pd);
		
	}

	@Override
	public List<PageData> findByBillCode(PageData pd) {
		
		return bookingNoteMapper.findByBillCode(pd);
	}

	@Override
	public PageData findTaxByBillCode(PageData pd) {
		return bookingNoteMapper.findTaxByBillCode(pd);
	}

	@Override
	public PageData findCostOutByBillCode(PageData pd) {
		return bookingNoteMapper.findCostOutByBillCode(pd);
	}
}
